package com.whfc.wxmp.api.sys.controller;

import com.alibaba.fastjson.JSONObject;
import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.entity.dto.Apply.rep.DailyReportDisplayRep;
import com.whfc.entity.dto.Apply.rep.InstitutionRep;
import com.whfc.entity.dto.Apply.req.AppEntryApplicationDTO;
import com.whfc.entity.dto.Apply.req.AppReportRrq;
import com.whfc.entity.dto.Apply.req.WorkDailyReportQueryReq;
import com.whfc.fuum.entity.WxUser;
import com.whfc.wxmp.annotation.CurrentWxUser;
import com.whfc.wxmp.api.sys.service.WxDailyReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Objects;

/**
 * @author xjy
 * @date 2025-09-19
 * 人员申请 and 日报
 */
@RestController
@RequestMapping("/mp/api/wxDaily")
public class WxDailyReportController {

    @Autowired
    private WxDailyReportService wxDailyReportService;

    /**
     *
     * @return 描述申请操作响应的字符串
     */
    @PostMapping("/wxDaily/saveReport")
    public Result saveReport(@CurrentWxUser WxUser user,@RequestBody AppReportRrq req) {
        int i = wxDailyReportService.saveReport(user, req);
        if(i > 0){
            return ResultUtil.success("提交成功");
        }
        return ResultUtil.failure("提交失败");
    }

    /**
     * 我收到的日报
     * @return
     */
    @PostMapping("/work/queryReport")
    public Result queryReport(@RequestBody WorkDailyReportQueryReq req) {
       List<DailyReportDisplayRep> displayReps = wxDailyReportService.queryReport(req);
        return ResultUtil.success(displayReps);
    }

    /**
     * 我发出的日报
     * @return
     */
    @PostMapping("/work/myDailyReport")
    public Result myDailyReport(@CurrentWxUser WxUser user,@RequestBody WorkDailyReportQueryReq req) {
        List<DailyReportDisplayRep> displayReps = wxDailyReportService.myDailyReport(user,req);
        return ResultUtil.success(displayReps);
    }






















































}
